<%@ page language="java" import="java.util.*,com.lab.po.Student"
	pageEncoding="utf-8"%>
<%@ page import="com.lab.dao.impl.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<title>显示用户信息</title>

     <style type="text/css">
       input[type="text"]{
              height: auto;
	          margin-top: 8px;
	          padding: 3px 9px;
            }
        a {
  			cursor:pointer;
		}
     </style>
     <script type="text/javascript" src="${pageContext.request.contextPath}/jquery/jquery-1.8.3.js"></script>
	</head>

<script type="text/javascript">
function query(){
	//去除所有的空格
	var regExp=/\s/g;
	var stuid=$("#stuid").val().replace(regExp,"");
    	$.ajax({
    		url:"${pageContext.request.contextPath}/showStuPwdAjax",
    		type:"post",
    		data:{stuid:stuid},
    		dataType:"json",
    		success:function(result){
    			$("#stutable").html('');
    			$.each(result,function(inx,ele){
    			$("#stutable").append("<tr><td align='center' width='50%'><strong>姓名</strong></td>"
    					+"<td align='center' width='50%'><strong>执行操作</strong></td></tr>"
    					+"<tr><td align='center' width='50%'>"+ele.stName+"</td>"
    					+"<td align='center' width='50%'><a  onclick='det("+ele.stId+")' class='btn btn-danger'>重置密码</a></td></tr>");
    			})
    		}

    	});
}

function det(id){
	if(confirm("确定要重置吗？")) {
		location.href = "updateServlet?method=updateStuPwd&stId=" + id;
	}
}
</script>
	<body>

        <div class="container" >
        	<div align="center">
          	 学号：<input type="text" name="searchId" id="stuid" placeholder="请输入需要重置的学生学号...">&nbsp;
          	 <i class="icon-search"></i>&nbsp;
          	 <button type="button" class="btn btn-inverse" onclick="query()"> 查找</button>
          	 </div>
        </div>
		<table  class="table table-hover table-condensed" id="stutable">		
		</table>	
		<hr>
		<a href="main.jsp" class="btn btn-success">返回主菜单</a>
		<hr>


	</body>
</html>
